home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: ned.cray.com!phaser!aztec
- From: aztec@cray.com (Joel Garcia-Trevino {x66457 CF/DEV})
- Subject: Multiple Abstract Classes Question
- Message-ID: <1996Jan17.160425.6063@ned.cray.com>
- Nntp-Posting-Host: phaser.cray.com
- Reply-To: aztec@cray.com
- Organization: Cray Research, Inc.
- Date: 17 Jan 96 16:04:25 CST
-
-
- Can I or is it a good idea to have multiple abstract classes to start building
- a class hierarchy?
-
- Example of the base (abstract) classes:
-
- class base_type;
-
- class base_net {
- public:
- virtual char *get_name() = 0; // Gets the name
- virtual base_type *get_type() = 0; // Gets pointer to type
- };
-
- class base_type {
- public:
- virtual char *get_type() = 0; // Gets type name
- };
-
-
- The final classes would look something like:
-
- class type;
-
- class net: public base_net {
- private:
- char *name;
- type *type_pntr;
-
- public:
- char *get_name() { ..... };
- type *get_type() { ..... };
-
- };
-
- class type: public base_type {
- private:
- char *type_name;
-
- public:
- char *get_type() { ..... };
-
- };
-
-
- Does it make sense to do it this way?
-
- The reason why I want to do this is because there will be different types
- of nets that I will need to work with. I don't know if there will be
- different types of "type" but I thought why not make them all abstract. ???
-
-
- Thanks in advance for your help,
-
-
- Joel Garcia
-
-
-
-